package executors;
import objects.Command;

public enum COMMAND_TYPE {
		ADD, SUBADD, SORT, SET, DELETE, SEARCH, GET, WRITE_FILE, READ_FILE, EXPORT, IMPORT, EXIT, INVALID;
		
		static COMMAND_TYPE determineCommandType(Command command) {
			String commandTypeString = command.getCommandType();

			if (commandTypeString == null)
				throw new Error("command type string cannot be null!");

			if (commandTypeString.equalsIgnoreCase("add")) {
				return COMMAND_TYPE.ADD;
			} else if (commandTypeString.equalsIgnoreCase("subadd")) {
				return COMMAND_TYPE.SUBADD;
			} else if (commandTypeString.equalsIgnoreCase("sort")) {
				return COMMAND_TYPE.SORT;
			} else if (commandTypeString.equalsIgnoreCase("set")) {
				return COMMAND_TYPE.SET;
			} else if (commandTypeString.equalsIgnoreCase("delete")) {
				return COMMAND_TYPE.DELETE;
			} else if (commandTypeString.equalsIgnoreCase("search")) {
				return COMMAND_TYPE.SEARCH;
			} else if (commandTypeString.equalsIgnoreCase("get")) {
				return COMMAND_TYPE.GET;
			} else if (commandTypeString.equalsIgnoreCase("write")) {
				return COMMAND_TYPE.WRITE_FILE;
			} else if (commandTypeString.equalsIgnoreCase("read")) {
				return COMMAND_TYPE.READ_FILE;
			} else if (commandTypeString.equalsIgnoreCase("export")) {
				return COMMAND_TYPE.EXPORT;
			} else if (commandTypeString.equalsIgnoreCase("import")) {
				return COMMAND_TYPE.IMPORT;
			} else if (commandTypeString.equalsIgnoreCase("exit")) {
				return COMMAND_TYPE.EXIT;
			} else
				return COMMAND_TYPE.INVALID;
		}
	}
	
	
	



